{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# DC Extrapolation for Time Domain "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Extrapolates the low frequency points needed for time-domain transformations, when measurement doesn't include DC.\n",
    "\n",
    "Example:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import skrf\n",
    "from skrf.media import Coaxial\n",
    "import matplotlib.pyplot as plt\n",
    "from skrf.plotting import stylely\n",
    "stylely()\n",
    "%matplotlib inline\n",
    "\n",
    "freq = skrf.F(0.11,110,1001)\n",
    "coax1mm = Coaxial(freq, z0=50, Dint=0.44e-3, Dout=1.0e-3, sigma=1e20)\n",
    "\n",
    "X = coax1mm.line(10, 'mm', z0=50, name='X', embed=True)\n",
    "Y = coax1mm.line(80, 'mm', z0=75, name='Y', embed=True)\n",
    "dut = X**Y**X\n",
    "\n",
    "dut_dc = dut.extrapolate_to_dc(dc_sparam=[[0,1],[1,0]])\n",
    "\n",
    "plt.figure()\n",
    "plt.title('Step')\n",
    "t, y = dut.s11.step_response(pad=2000)\n",
    "t2, y2 = dut_dc.s11.step_response(pad=2000)\n",
    "plt.plot(t*1e9, y, label='Original')\n",
    "plt.plot(t2*1e9, y2, label='Extrapolated')\n",
    "plt.legend()\n",
    "plt.xlabel('Time (ns)')\n",
    "\n",
    "plt.figure()\n",
    "plt.title('Impulse')\n",
    "t, y = dut.s11.impulse_response(pad=2000)\n",
    "t2, y2 = dut_dc.s11.impulse_response(pad=2000)\n",
    "plt.plot(t*1e9, y, label='Original')\n",
    "plt.plot(t2*1e9, y2, label='Extrapolated')\n",
    "plt.legend()\n",
    "plt.xlabel('Time (ns)')\n",
    "\n",
    "plt.show(block=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.5"
  },
  "toc": {
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "toc_cell": false,
   "toc_position": {},
   "toc_section_display": "block",
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
